package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.DigitalCollectionProductInfoAuctionCondition;
import com.sc.nft.entity.DigitalCollectionProductInfoCondition;
import com.sc.nft.mapper.DigitalCollectionProductInfoAuctionConditionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author：LiGen
 * @Package：com.sc.nft.dao
 * @Project：sc_metago
 * @name：DigitalCollectionProductInfoAuctionDao
 * @Date：2024/9/5 14:57
 * @Filename：DigitalCollectionProductInfoAuctionDao
 */
@Slf4j
@Repository
public class DigitalCollectionProductInfoAuctionConditionDao extends ServiceImpl<DigitalCollectionProductInfoAuctionConditionMapper, DigitalCollectionProductInfoAuctionCondition> {

    public void removeByProductId(Long id) {
        LambdaUpdateWrapper<DigitalCollectionProductInfoAuctionCondition> wrapper = Wrappers.lambdaUpdate();
        wrapper.eq(DigitalCollectionProductInfoAuctionCondition::getProductId,id);
        remove(wrapper);
    }

    public List<DigitalCollectionProductInfoAuctionCondition> getDigitalCollectionProductInfoAuctionConditionByProductId(Long id) {
        LambdaQueryWrapper<DigitalCollectionProductInfoAuctionCondition> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(DigitalCollectionProductInfoAuctionCondition::getProductId, id);
        return baseMapper.selectList(wrapper);
    }



    public List<DigitalCollectionProductInfoAuctionCondition> listByProductId(Long productId) {
        LambdaQueryWrapper<DigitalCollectionProductInfoAuctionCondition> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DigitalCollectionProductInfoAuctionCondition::getProductId,productId);
        return this.list(queryWrapper);
    }
}
